package com.hzqy.persistence.dao.epg;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.hzqy.web.vo.epg.gcw.AcTicketNumVo;
import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import com.hzqy.persistence.dao.core.PersistenceDao;
import com.hzqy.web.vo.AcWinningVo;
import com.hzqy.web.vo.CmContentVo;
import com.hzqy.web.vo.activity.ActivityVoteUserVo;
import com.hzqy.web.vo.epg.AcIntegralVo;
import com.hzqy.web.vo.epg.CmSvcVoteTotalVo;
import com.hzqy.web.vo.epg.gcw.AcStbUserVotenum;

@Repository
public class AcIntegralDao  extends PersistenceDao<AcIntegralVo, Integer>{
	public int selectCommunityCount(Map map) {
		return getSqlSession().selectOne(this.getNamespace()+"selectCommunityCount", map);
	}
	public List<AcIntegralVo> selectCommunityIntegral(Map map){
		return getSqlSession().selectList(this.getNamespace() + "selectCommunityIntegral",map);
	}
	public AcIntegralVo selectCommunityLike(Map map) {
		return getSqlSession().selectOne(this.getNamespace()+"selectCommunityLike", map);
	}

	public List<AcIntegralVo> selectAivPhone(Map map){
		return getSqlSession().selectList(this.getNamespace() + "selectAivPhone",map);
	}
	public List<AcIntegralVo> selectIndividualRanking(Map map){
		return getSqlSession().selectList(this.getNamespace() + "selectIndividualRanking",map);
	}
	public String selectSasId(String f_wtut_serverid){
		return getSqlSession().selectOne(this.getNamespace() + "selectSasId",f_wtut_serverid);
	}
	public int insertACLikeVote(ActivityVoteUserVo acVoteUserVo) {
		return getSqlSession().insert(this.getNamespace()+"insertACLikeVote", acVoteUserVo);
	}
	public List<ActivityVoteUserVo> selectAcLikeVotenum(ActivityVoteUserVo acVoteUserVo) {
		return getSqlSession().selectList(this.getNamespace()+"selectAcLikeVotenum", acVoteUserVo);
	}
	public List<ActivityVoteUserVo> selectAcLikeVoteList(ActivityVoteUserVo acVoteUserVo) {
		return getSqlSession().selectList(this.getNamespace()+"selectAcLikeVoteList", acVoteUserVo);
	}
	
	public String selectUserSasNameBy(String f_wtut_phone){
		return getSqlSession().selectOne(this.getNamespace() + "selectUserSasNameBy",f_wtut_phone);
	}
	public int selectAcContentVotenumCount(int id,String f_cp_cprid,CmContentVo contentVo){
		Map<String,Object> map = new HashMap<String, Object>();
		map.put("f_catalog_id", id);
		map.put("f_catalog_ids", contentVo.getF_catalog_ids());
		map.put("f_cp_cprid", f_cp_cprid);
		map.put("luckyBaby_qualification", contentVo.getLuckyBaby_qualification());
		map.put("f_cc_searchname", contentVo.getF_cc_searchname());//编号 
		map.put("f_csvt_activityid", contentVo.getF_csvt_activityid());
		return getSqlSession().selectOne(this.getNamespace() + "selectAcContentVotenumCount", map);
	}
	public List<CmContentVo> selectAcContentVotenumList(int id,int pageNo,int pageSize,String f_cp_cprid,CmContentVo contentVo){
		Map<String,Object> map = new HashMap<String, Object>();
		map.put("f_catalog_id", id);
		map.put("f_catalog_ids", contentVo.getF_catalog_ids());
		map.put("f_cp_cprid", f_cp_cprid);
		map.put("f_cc_searchname", contentVo.getF_cc_searchname());//编号 
		map.put("luckyBaby_qualification", contentVo.getLuckyBaby_qualification());
		map.put("f_csvt_activityid", contentVo.getF_csvt_activityid());
		map.put("firstResult", pageNo);
		map.put("pageSize", pageSize);
		String sort_column=contentVo.getSort_column();
		if("".equals(sort_column)||sort_column==null||"undefined".equals(sort_column)){
			contentVo.setSort_column("f_csvt_votecount desc,f_ccc_viewindex desc, f_cc_id desc");
		}
		map.put("sort_column", contentVo.getSort_column());
		return getSqlSession().selectList(this.getNamespace() + "selectAcContentVotenumList", map);
	}
	public int insertCmSvcVoteTotalVo(CmSvcVoteTotalVo csvt) {
		return getSqlSession().insert(this.getNamespace()+"insertCmSvcVoteTotalVo", csvt);
	}
	public int updateCmSvcVoteTotalVo(CmSvcVoteTotalVo csvt) {
		return getSqlSession().update(this.getNamespace() + "updateCmSvcVoteTotalVo", csvt);
	}
	public List<CmSvcVoteTotalVo> selectCmSvcVoteTotal(CmSvcVoteTotalVo csvt){
		Map<String,Object> map = new HashMap<String, Object>();
		map.put("f_csvt_activityid", csvt.getF_csvt_activityid());
		map.put("f_csvt_contentid", csvt.getF_csvt_contentid());
		map.put("f_csvt_obligate1", csvt.getF_csvt_obligate1());
		return getSqlSession().selectList(this.getNamespace() + "selectCmSvcVoteTotal", map);
	}
	/**
	 * 查询清理缓存
	 * */
	public List<ActivityVoteUserVo> selectClearCacheVote() {
		return getSqlSession().selectList(this.getNamespace()+"selectClearCacheVote");
	}
	
	public int insertAcStbUserVotenum(AcStbUserVotenum acvote) {
		return getSqlSession().insert(this.getNamespace()+"insertAcStbUserVotenum", acvote);
	}

	public List<AcStbUserVotenum> selectAcStbUserVotenumList(AcStbUserVotenum acVoteUserVo) {
		return getSqlSession().selectList(this.getNamespace()+"selectAcStbUserVotenumList", acVoteUserVo);
	}

	public int updateAcTicketNum(Map map){
		return getSqlSession().update(this.getNamespace() + "updateAcTicketNum", map);
	}
	public AcTicketNumVo selectAcTicketNum(String f_at_password){
		return getSqlSession().selectOne(this.getNamespace() + "selectAcTicketNum",f_at_password);
	}
	public Integer selectCountNum(Map map){
		return getSqlSession().selectOne(this.getNamespace() + "selectCountNum",map);
	}
    /*品质标更改二维码为获取验证码*/
	public String selectPzbCode(Map map){
		return getSqlSession().selectOne(this.getNamespace() + "selectPzbCode",map);
	}
	public AcTicketNumVo selectPzbCodeNum(Map map){
		return getSqlSession().selectOne(this.getNamespace() + "selectPzbCodeNum",map);
	}

	public int updatePzbCodeNum(Map map){
		return getSqlSession().update(this.getNamespace() + "updatePzbCodeNum", map);
	}
	public List<CmSvcVoteTotalVo> selectVoteTotalRownum(Map map){
		return getSqlSession().selectList(this.getNamespace() + "selectVoteTotalRownum", map);
	}
	
	/* 查询活动下的每个用户的投票总数 */
	public List<ActivityVoteUserVo> selectAcLikeVotenumByActivityId(ActivityVoteUserVo acVoteUserVo) {
		return getSqlSession().selectList(this.getNamespace()+"selectAcLikeVotenumByActivityId", acVoteUserVo);
	}
	
	/**
	 * 	修改投票总数表备注
	 * @param csvt
	 * @return
	 */
	public int updateCmSvcVoteTotalVoRemark(CmSvcVoteTotalVo csvt) {
		return getSqlSession().update(this.getNamespace() + "updateCmSvcVoteTotalVoRemark", csvt);
	}
	
}
